<!--
 * @Author: your name
 * @Date: 2021-04-12 11:39:57
 * @LastEditTime: 2021-04-13 17:34:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \dolphin-data-center-front-end\src\pages\components\standardTable\index.vue
-->
<template>
  <a-card :hoverable="true" :bordered="false" v-if="isShow" style="margin-top:30px">
    <div class="tableCommon-wrapper">
      <a-table :columns="tableHead" :dataSource="tableData" :loading="loading" :pagination="pagination" :row-selection="rowSelection" @change="handleTableChange" rowKey="id" :scroll="scroll">
        <template slot-scope="text, record, index" :slot="slot" v-for="slot in Object.keys($scopedSlots).filter(key => key !== 'expandedRowRender')">
          <slot :name="slot" v-bind="{ text, record, index }"></slot>
        </template>
      </a-table>
    </div>
  </a-card>
</template>

<script>
export default {
  name: 'standardTable',
  props: {
    tableHead: {
      type: Array,
      required: true
    },
    isShow: {
      type: Boolean,
      required: true
    },
    tableData: {
      type: Array,
      required: true
    },
    loading: {
      type: Boolean,
      default: false
    },
    pagination: {
      type: Boolean || Object
    },
    rowSelection: {
      type: Object
    },
    scroll: {
      type: Object
    }
  },
  data () {
    return {};
  },
  methods: {
    handleTableChange (val) {
      this.$emit('changeCurrent', val.current);
    }
  }
};
</script>
<style lang="less" scoped></style>